app.filter("workType", function () {
  return function (type) {
    switch (type) {
      case 0:
        return "常规任务";
      case 1:
        return "临时任务";
    }
  }
});


app.filter("orgActivityType", function () {
  return function (type) {
    switch (type) {
      case 0:
        return "活动";
      case 1:
        return "会议";
    }
  }
});


app.filter('groupBy', function () {
  return _.memoize(function (items, field) {
      return _.groupBy(items, field);
    }
  );
});

var payType = ['微信支付', '支付宝', '易支付'];
app.filter('payType', function () {
  return function (type) {
    return payType[type];
  }
});

app.filter('pointType', function () {
  return function (type) {
    switch (type) {
      case 0:
        return "工作上报";
      case  1:
        return "捐款";
      case 2:
        return "党费缴纳";
    }
  }
});
app.filter('confirm', function () {
    return function (type) {
        switch (type) {
            case 0:
                return "未领";
            case  1:
                return "已领";
            case  2:
                return "逾期";
        }
    }
});
chineseDigit = ['一', '二', '三', '四', '五', '六', '七', '八', '九', '十', '十一', '十二']
app.filter('chineseMonth', function () {
  return function (value) {
    var now = new Date();
    var d = stringToDate(value + "-01");
    var month = d.getMonth();
    var curMonth = now.getMonth();
    if (month == curMonth) {
      return "本月";
    } else {
      return chineseDigit[month] + "月";
    }
  }
});
app.filter('chineseWeek', function () {
  return function (value) {
    var d=new Date(value);
    var week = d.getDay();
    if (week != 6) {
      return "星期" + chineseDigit[week];
    } else {
      return "星期天";
    }
  }
});
app.filter('zhibi_bank',function () {
    return function (arr, id) {
        var output = [],keys=[];
        angular.forEach(arr, function (item) {
            var key = item[id];
            if(key=='1'){}
        });
        return output;
    }
});
function stringToDate(fDate) {
  var fullDate = fDate.split("-");
  return new Date(fullDate[0], fullDate[1] - 1, fullDate[2]);
}
